package com.web.controller;


import com.service.user.UserService;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

@Controller
public class IndexController {

    //引用远程服务
    @DubboReference(interfaceClass = UserService.class,version = "1.0")
    private UserService userService;

/********************首页*************************/
    @GetMapping({"/index","/",""})
    public String index(Model model){
        //调用远程服务，才能获取注册用户数量
        int registerUsers = userService.queryRegisterUsers();

        //保存数据
        model.addAttribute("registerUsers",registerUsers);
        return "index";
    }
}
